import re

import scrapy


class GiteeSpider(scrapy.Spider):
    name = 'gitee'
    allowed_domains = ['gitee.com']
    start_urls = ['https://gitee.com/login']

    def parse(self, response):
        yield scrapy.FormRequest.from_response(
            response,#自动从response中寻找Form表单
            formdata={"user[login]":"flatts@live.cn","user[password]":"bugaosuni"},
            callback = self.after_login
        )

    def after_login(self,response):
        print(re.findall("flatts",response.body.decode()))